package com.ggkt.module.organizationalStruture.entity;

import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@ToString
public class ResultBean<T extends Object> {
    /**
     * 失败
     */
    public static final int CODE_FAIL=100;
    public static final int CODE_SUCCESS=200;
    public static final int CODE_EXCEPTION=500;
    /**无参数*/
    public static final int CODE_NO_PARAM=400;
    /**无效参数*/
    public static final int CODE_NO_PARAM_VERIFY=402;
    public static final int CODE_SIGN_ERROR=401;
    public static final int CODE_NO_AUTH=403;
    //错误码
    private int code=CODE_SUCCESS;
    //消息
    private String msg;
    //数据
    private T data;
    //令牌
    private String token;
    public ResultBean(){
    }
    public ResultBean(int code){
        this.code=code;
    }
    public ResultBean(int code, String msg){
        this.code=code;
        this.msg=msg;
    }

    /**
     * 注意：泛型的 T不能为string ，否则就是同 ResultBean(int code,String msg)
     * @param code
     * @param data
     */
    public ResultBean(int code, T data){
        this.code=code;
        this.data=data;
    }
    public ResultBean(int code, String msg, T data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }
}
